package com.ruoyi.environment.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import cn.hutool.core.util.IdUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.core.utils.SecurityUtils;
import com.ruoyi.environment.mapper.OpmEnvEquipmentMapper;
import com.ruoyi.environment.domain.OpmEnvEquipment;
import com.ruoyi.environment.service.IOpmEnvEquipmentService;

/**
 * 园区设备Service业务层处理
 *
 * @author cjie
 * @date 2021-07-23
 */
@Service
public class OpmEnvEquipmentServiceImpl implements IOpmEnvEquipmentService {
    @Autowired
    private OpmEnvEquipmentMapper opmEnvEquipmentMapper;

    /**
     * 查询园区设备
     *
     * @param id 园区设备ID
     * @return 园区设备
     */
    @Override
    public OpmEnvEquipment selectOpmEnvEquipmentById(Long id) {
        return opmEnvEquipmentMapper.selectOpmEnvEquipmentById(id);
    }

    /**
     * 查询园区设备列表
     *
     * @param opmEnvEquipment 园区设备
     * @return 园区设备
     */
    @Override
    public List<OpmEnvEquipment> selectOpmEnvEquipmentList(OpmEnvEquipment opmEnvEquipment) {
        return opmEnvEquipmentMapper.selectOpmEnvEquipmentList(opmEnvEquipment);
    }

    /**
     * 新增园区设备
     *
     * @param opmEnvEquipment 园区设备
     * @return 结果
     */
    @Override
    public int insertOpmEnvEquipment(OpmEnvEquipment opmEnvEquipment) {
        opmEnvEquipment.setId(IdUtil.getSnowflake(0, 0).nextId());
        opmEnvEquipment.setCreateTime(DateUtils.getNowDate());
        opmEnvEquipment.setCreateBy(SecurityUtils.getUsername());
        return opmEnvEquipmentMapper.insertOpmEnvEquipment(opmEnvEquipment);
    }

    /**
     * 修改园区设备
     *
     * @param opmEnvEquipment 园区设备
     * @return 结果
     */
    @Override
    public int updateOpmEnvEquipment(OpmEnvEquipment opmEnvEquipment) {
        return opmEnvEquipmentMapper.updateOpmEnvEquipment(opmEnvEquipment);
    }

    /**
     * 批量删除园区设备
     *
     * @param ids 需要删除的园区设备ID
     * @return 结果
     */
    @Override
    public int deleteOpmEnvEquipmentByIds(Long[] ids) {
        return opmEnvEquipmentMapper.deleteOpmEnvEquipmentByIds(ids);
    }

    /**
     * 删除园区设备信息
     *
     * @param id 园区设备ID
     * @return 结果
     */
    @Override
    public int deleteOpmEnvEquipmentById(Long id) {
        return opmEnvEquipmentMapper.deleteOpmEnvEquipmentById(id);
    }
}
